// 长者管理

import { alovaInstance as alova } from './alova'
import type { ApiCommonResponse, FormSubmitFields, MutipleType, OldListQuery } from '@/types'

export const saveOld = (data: FormSubmitFields, id?: number) => alova.Put<ApiCommonResponse>(`/member/${id}/save`, { ...data })

export function queryOldDetail(ID: string | number) {
  return alova.Get<ApiCommonResponse>(`/member/${ID}/detail`, {
    localCache: void 0,
  })
}
export const addOld = (data: FormSubmitFields) => alova.Post<ApiCommonResponse>('/member/add', { ...data })
export const queryOldList = (data: OldListQuery) => alova.Post<ApiCommonResponse>('/member/list', { ...data })

// /api/v1/bed/select
export function queryBedSelect() {
  return alova.Get<ApiCommonResponse>('/bed/select', {
    localCache: void 0,
  })
}

// 根据照护等级查询服务包
export function queryPackageByLevel(id: MutipleType) {
  return alova.Get<ApiCommonResponse>(`/package/level/${id}`, {
    localCache: void 0,
  })
}
